import { Component } from "react";
import { globalContext } from './global'
const { Consumer } = globalContext

class Son1 extends Component {
    render() {
        return (
            <div>
                子组件1
                <Consumer>
                    {
                        value=><div>
                            <span>姓名:{value.name}</span>
                            <p>--邮箱:{value.email}</p>
                            <button onClick={()=>value.changeName('王五')}>修改全局数据--子组件1</button>
                            </div>
                    }
                </Consumer>

            </div>
        );
    }
}


export default Son1